#ifndef __CLOUD_H
#define __CLOUD_H

//----------------------------------Include-------------------------------------
#include  <stdint.h>
//------------------------------------------------------------------------------

//-----------------------------------Macro--------------------------------------
#define CLD_CMD_DEV_DATA_UP          (0x81)
#define CLD_CMD_DEV_GPS_UP           (0x82)
#define CLD_CMD_DEV_CFG_UP           (0x83)

#define CLD_CMD_DEV_REQ_CNCT         (0x71)
#define CLD_CMD_CLD_ACK_CNCT         (0x72)

#define CLD_CMD_DEV_REQ_CFG          (0x51)
#define CLD_CMD_CLD_ACK_CFG          (0x52)
#define CLD_CMD_DEV_RSP_CFG          (0x53)

#define CLD_CMD_DEV_REQ_UTC          (0x41)
#define CLD_CMD_CLD_ACK_UTC          (0x42)
//------------------------------------------------------------------------------

//------------------------------------Type--------------------------------------
typedef struct{
  uint32_t    up_utc;
  uint32_t    up_flag;
}t_up;
//------------------------------------------------------------------------------

//---------------------------------Share Var------------------------------------
#ifdef  CLOUD_GLOBALS
#else
extern uint32_t                            gu32_up_done;
extern t_up                                gt_up_data;
extern t_up                                gt_up_cfg;
extern t_up                                gt_up_gps;
extern t_up                                gt_up_cnct;
#endif
//------------------------------------------------------------------------------

//----------------------------------Declare-------------------------------------
uint32_t cloud_dev_data_up(uint8_t* p);
uint32_t cloud_dev_gps_up(uint8_t* p);
uint32_t cloud_dev_cfg_up(uint8_t* p);
uint32_t cloud_save_cfg(char* p, uint32_t len);
uint8_t  cloud_chk_form(char* pbuf, uint32_t sz, char** vp, uint16_t* vlen);
//------------------------------------------------------------------------------
void cloud_parse(char* pbuf, uint32_t sz);
void cloud_reset(void);
void cloud_cyc(void);
//------------------------------------------------------------------------------

#endif
//------------------------------------EOF---------------------------------------

